package com.suke.czx.modules.project.entity;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.suke.czx.common.validate.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 应用模块名称: 项目
 * 代码描述: 项目实体
 * copyright: AUZAR ALL RIGHTS RESERVED
 * company: AUZAR
 *
 * @author: 颜米晨
 * @date: 2021/09/07 10:13:20
 */
@Data
@ApiModel(value = "项目管理")
@EqualsAndHashCode(callSuper = true)
public class Project extends Model<Project> {

    @ApiModelProperty(value = "项目id")
    @TableId(value = "project_id", type = IdType.AUTO)
    @NotNull(groups = {ProjectUpdateGroup.class}, message = "项目编码不能为空")
    public Long projectId;

    @ApiModelProperty(value = "项目名称")
    @NotBlank(groups = {ProjectSaveGroup.class, ProjectUpdateGroup.class}, message = "项目名称不能为空")
    public String projectName;

    @ApiModelProperty(value = "负责人id")
    @NotNull(groups = {ProjectSaveGroup.class, ProjectUpdateGroup.class}, message = "负责人不能为空")
    public Long managerId;

    @TableField(exist = false)
    @ApiModelProperty(value = "负责人姓名")
    public String managerName;

    @ApiModelProperty(value = "业务员id")
    @NotNull(groups = {ProjectSaveGroup.class, ProjectUpdateGroup.class}, message = "业务员不能为空")
    public Long salesId;

    @TableField(exist = false)
    @ApiModelProperty(value = "业务员姓名")
    public String salesName;

    @ApiModelProperty(value = "客户id")
    @NotNull(groups = {ProjectSaveGroup.class, ProjectUpdateGroup.class}, message = "客户不能为空")
    public Long customerId;

    @TableField(exist = false)
    @ApiModelProperty(value = "客户名称")
    public String customerName;

    @ApiModelProperty(value = "项目类型id")
    @NotNull(groups = {ProjectSaveGroup.class, ProjectUpdateGroup.class}, message = "项目类型不能为空")
    public Long projectTypeId;

    @TableField(exist = false)
    @ApiModelProperty(value = "项目类型名称")
    public String projectTypeName;

    @ApiModelProperty(value = "计划交付时间")
    @NotNull(groups = {ProjectSaveGroup.class, ProjectUpdateGroup.class}, message = "计划交付时间不能为空")
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    public Date completeTime;

    @ApiModelProperty(value = "项目状态  1-跟单中 2-丢单 3-进行中 4-完成 5-终止 6-暂停")
    @NotNull(groups = {ProjectSaveGroup.class, ProjectUpdateGroup.class}, message = "项目状态不能为空")
    @EnumValue(groups = {ProjectSaveGroup.class, ProjectUpdateGroup.class}, intValues = {1, 2, 3, 4, 5, 6}, message = "项目状态只能是1,2,3,4,5,6")
    public Integer status;

    @TableField(exist = false)
    @ApiModelProperty(value = "项目状态名称")
    public String statusName;

    @ApiModelProperty(value = "备注")
    public String note;

    @ApiModelProperty(value = "删除标记  0：删除   1：正常")
    public Integer del;

    @ApiModelProperty(value = "创建者id")
    public Long creator;

    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    public Date createTime;

    @ApiModelProperty(value = "更新者id")
    public Long updater;

    @ApiModelProperty(value = "更新时间")
    public Date updateTime;

}
